#include "thread.h"
#include <stdio.h>
#include <stdlib.h>
#include <ucontext.h>


int thread_join(thread_t *thread, void **retval){
	//  printf("le status du thread %p est %d\n",&thread, thread.status);
	//printf("on attend le thread %d\n",thread->id);

	while(thread->status){
		thread_yield();
	}
	//printf("le thread %d a été libéré\n",thread->id);
	if(retval!=NULL)
		*retval=thread->ret;
    
	return 0;
}
